import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import PreHome from "../views/preHome.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "/home",
    name: "home",
    component: Home,
    children: [
      {
        name: "",
        path: "",
        component: function() {
          return import("../components/myTable.vue");
        },
      },
      {
        name: "tree",
        path: "tree",
        component: function() {
          return import("../components/tree.vue");
        },
      },
      // {
      //   name: "upload",
      //   path: "upload",
      //   component: function() {
      //     return import("../components/upload.vue");
      //   },
      // },
    ],
  },
  {
    path: "/preHome",
    name: "preHome",
    component: PreHome,
    children: [
      {
        name: "",
        path: "",
        component: function() {
          return import("../components/login.vue");
        },
      },
      {
        name: "register",
        path: "register",
        component: function() {
          return import("../components/register.vue");
        },
      },
      // {
      //   name: "tree",
      //   path: "tree",
      //   component: function() {
      //     return import("../components/tree.vue");
      //   },
      // },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
